<%@page import="org.beanstech.persistence.Tblbook"%>
<%@page import="org.beanstech.dao.UserDao"%>
<%@page import="org.beanstech.persistence.Tbluser"%>
<%@page import="org.beanstech.dao.ObjectsByIds"%>
<%@page import="com.ckeditor.CKEditorConfig"%>
<%@page import="java.util.Iterator"%>
<%@page import="org.beanstech.model.SystemModel"%>
<%@page import="org.beanstech.persistence.Mstblsubject"%>
<%@page import="java.util.List"%>
<%@page import="org.beanstech.dao.DropDownConstructDao"%>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<%
	if(session.getAttribute("userid")==null){
	%>
	<jsp:forward page="Before_login.jsp"></jsp:forward>
	<%} %>

<%@include file="header.jsp" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="js/jquery.numeric.js"></script>
	
	<link rel="stylesheet" href="css/main.css" type="text/css" />
	<script type="text/javascript">
	function loginsubmit(){
		document.getElementById("sellbook").submit();
		
	}
	</script>
	<title>Second Book Exchange | Effort towards Green Campaign</title>
	
	<%
	DropDownConstructDao dropdown = new DropDownConstructDao();
	List<SystemModel> customlist = dropdown.getSubjectList();
	UserDao doa = new UserDao();
	int user = (Integer)session.getAttribute("userid");
	Tbluser bookuser = doa.getUserById(user);
	
	%>
</head><body>
	
		<div id="full_div_text">
		<div class="mydiv">
 		<h2>Welcome </h2>
		</div>
		
		</div>
		<div class="mydiv">
			
			<table align="center" width="300px">
			<tr>
				<td colspan="2"><%= bookuser.getBooks().size() == 0?"No Books Found for sale":"You have "+bookuser.getBooks().size()+" book for sale" %> <br /></td>
			</tr>
			<%if(bookuser.getBooks().size() != 0){
				for(Iterator i = bookuser.getBooks().iterator(); i.hasNext();){
					Tblbook book = (Tblbook)i.next();
					%>
					<tr>
						<td width="60px" align="center">
						<%if(book.getBookimage()== null){ %>
							<img src="bookimg/default.png" height="60px" width="50px"/ >
						<%}else { %>
								<img src="bookimg/<%=book.getBookimage() %>" height="60px" width="50px"/ >
						<%} %>
						</td>
						<td width="90px"><%=book.getBookname() %> by <%=book.getAuthor() %> </td>
						
						<td width="50px"><span class="yellowrupee">`</span> <span><%=book.getOfferprice() %></span></td>
						<td width="50px"><button>Details</button>&nbsp;<button>Update</button></td>
						<td width="50px"></td>
						
					</tr>
					
					<% 
				}
				%>
			
			<%} %>
			</table>
		</div>
		<div id="text">
			
			
			
			
		</div>
		
		
		

		
</body>
</html>
<jsp:include page="footer.jsp"></jsp:include>